#include <iostream>

using namespace std;
class Solution {
   public:
    char firstUniqChar(string s) {
        int alphabet[26] = {};
        for (char c : s) {
            alphabet[int(c) - 97] += 1; // int(c - 'a')也行
        }
        for (char c : s) {
            if (alphabet[int(c) - 97] == 1) {
                return c;
            }
        }
        return ' ';
    }
};
int main() {
    Solution s;
    cout << s.firstUniqChar("leetcode") << endl;

    return 0;
}
